<script type="text/javascript">
	tinyMCE.init({
	    plugins : '-example', // - tells TinyMCE to skip the loading of the plugin
	    mode : "textareas",
	    theme : "advanced",
	    editor_selector : "rte",
	    theme_advanced_buttons1 : "mylistbox,mysplitbutton,bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,undo,redo,link,unlink",
	    theme_advanced_buttons2 : "",
	    theme_advanced_buttons3 : "",
	    theme_advanced_toolbar_location : "top",
	    theme_advanced_toolbar_align : "left",
	    theme_advanced_statusbar_location : "",

	    width: "420",
		height: "auto",
		entity_encoding: "raw",
		convert_urls : false

	});
</script>
{capture name=path}{l s='Post Ticket'}{/capture}
{include file="$tpl_dir./breadcrumb.tpl"}
				
<h2>{l s="Post Ticket page"}</h2>
{include file="$tpl_dir./errors.tpl"}
{if isset($complete) && $complete}
	<div class="confimComplete">
		<img src="{$img_ps_dir}admin/ok2.png" alt="" title="" />
		{l s="Your ticket was submitted and will be responded to as soon as possible."}<br />
		<span></span>{l s="Thank you for contacting us!"}
	</div>
{/if}
	
<div id="post-ticket">
	<form class="std" id="post-ticket_form" method="post" enctype="multipart/form-data" action="" >
		<fieldset class="time-support">
			<h3>{l s="Support time"}</h3>
			<p class="text">
				<label for="time-zone">{l s="Time Now"}</label>
				<span class="info"><b>{$zdate_now}</b></span>
			</p>
			<p class="text">
				<label for="time-zone">{l s="Time Zone"}</label>
				<span class="info"><b>{$timezone}</b></span>
			</p>
			<p class="text">
				<label for="working-day">{l s="Working Day"}</label>
				<table class="wokingday">
				{foreach from=$qkTime item=time key=day}
					<tr>
						<td><b>{$day}</b></td>
						<td>{$time}</td>
					</tr>
				{/foreach}
				</table>
			</p>
			<p class="text">
				<label for="status">{l s="Status"}</label>
				<span class="info" style="{if $statusTime}color:blue;{else}color:red;{/if}">{if $statusTime}Online{else}Offine{/if}</span>
			</p>
		</fieldset>
		
		<fieldset class="departments">
			<h3>{l s="Department"}</h3>
			<h4>{l s="Please select a support department"}</h4>
			<p class="select">
				<span>{l s="Department"}</span>
				<select name="id_department" id="id_department" class="id_department" onchange="updateDescription()">
					<option value="0" >-- Please select --</option>
					{foreach from=$listDepartments[0] item=department}
						<option value="{$department.value}" {if isset($complete) && $complete}{else}{if isset($smarty.post.id_department)} {if $smarty.post.id_department==$department.value}selected="selected"{/if}{/if}{/if}>{$department.name}</option>
					{/foreach}
						<option value="" disabled="disabled" style="color: gray">-- Login Required --</option>
					{foreach from=$listDepartments[1] item=department}
						<option value="{$department.value}{if $login==0}_login{/if}" {if isset($complete) && $complete}{else}{if isset($smarty.post.id_department)} {if $smarty.post.id_department==$department.value}selected="selected"{/if}{/if}{/if}>{$department.name}</option>
					{/foreach}
				</select>
			</p>
			<p class="text descripton_depart" >
			<span class="descripton_department" style="{if isset($errors) && $errors}{else}display:none;{/if}">Description: </span>
				{foreach from=$listDepartments[0] item=department}
					<span class="inline-infos" style="{if isset($errors) && $errors}{if isset($smarty.post.id_department)}{if $smarty.post.id_department==$department.value}{else}display:none;{/if}{else}display:none;{/if}{else}display:none;{/if}" id="department_{$department.value}">{$department.name}</span>
				{/foreach}
				{foreach from=$listDepartments[1] item=department}
					<div class="inline-infos" style="{if isset($errors) && $errors}{if isset($smarty.post.id_department)}{if $smarty.post.id_department==$department.value}{else}display:none;{/if}{else}display:none;{/if}{else}display:none;{/if}" id="department_{$department.value}">{$department.description}</div>
				{/foreach}
			<p>
		</fieldset>
		{if $login==0}
			<fieldset class="login-department" style="display:none;"><p class="buttons_bottom_block"><a class="button" href="{$base_dir}authentication.php?back=modules/zhelpdesk/zhelpdesk-post-ticket.php">Login</a></p></fieldset>
		{/if}
		<fieldset class="post-ticket" {if isset($errors) && $errors}style=""{else}style="display:none"{/if}>
			<h3>{l s="Create your's ticket"}</h3>
			{if $login==0}
				<p class="required text">
					<label for="customer_name">{l s="Name"}<sup>*</sup></label>
					<input type="text" name="name" id="name" value="{if isset($complete) && $complete}{else}{if isset($smarty.post.name)}{$smarty.post.name}{/if}{/if}" class="text"/>
				</p>
				<p class="required text">
					<label for="email">{l s="E-mail"}<sup>*</sup></label>
					<input type="text"  name="email" id="email" class="text" value="{if isset($complete) && $complete}{else}{if isset($smarty.post.email)}{$smarty.post.email}{/if}{/if}">
					<sup>*</sup>
				</p>
			{/if}
			{if $login==1 && sizeof(orders)>0}
				<p class="select">
					<span>{l s="Order"}</span>
					<select name="order" id="order">
						<option value="0" >{l s="-- Please select --"}</option>
					{foreach from=$orders item=order}
						<option value="{$order.id_order}" {if isset($complete) && $complete}{else}{if isset($smarty.post.order)} {if $smarty.post.order==$priority.id_order}selected="selected"{/if}{/if}{/if}>#{$order.id_order|string_format:"%06d"} - {displayPrice price=$order.total_paid_real currency=$order.id_currency no_utf8=false convert=false} - ({dateFormat date=$order.date_add full=0})</option>
					{/foreach}
					</select>
				</p>
			{/if}
			
			{if sizeof($prioritys)>0}
				<p class="select">
					<span>{l s="Priority"}</span>
					<select name="id_zhelpdesk_ticket_priority" id="id_zhelpdesk_ticket_priority" >
						{foreach from=$prioritys item=priority}
							<option style="color:{$priority.text_color};background-color:{$priority.backgroud_color}" id="id_zhelpdesk_ticket_priority_{$priority.id_zhelpdesk_ticket_priority}" value="{$priority.id_zhelpdesk_ticket_priority}" {if isset($smarty.post.id_zhelpdesk_ticket_priority)} {if $smarty.post.id_zhelpdesk_ticket_priority==$priority.id_zhelpdesk_ticket_priority}selected="selected"{/if}{/if}>{$priority.priority}</option>
						{/foreach}
					</select>
				</p>
			{/if}
			
			<p class="required text">
				<label for="subject">{l s="Subject"}<sup>*</sup></label>
				<input type="text" name="subject" id="subject" class="text" value="{if isset($complete) && $complete}{else}{if isset($smarty.post.subject)}{$smarty.post.subject}{/if}{/if}">
			</p>
		  
			<p class="textarea required">
				<label for="content" style="" >{l s="Message"}<sup>*</sup></label>
				<textarea class="" cols="48" rows="8" name="content" id="content" >{if isset($complete) && $complete}{else}{if isset($smarty.post.content)}{$smarty.post.content}{/if}{/if}</textarea>
			</p>
			<p class="text" style="padding-top: 17px;">
				<label for="content" style="content-post-ticket">{l s="File Attachment"}</label>
				<input type="file" value="" name="attached_files" />
			</p>
		</fieldset>
		<p class="cart_navigation required submit post-ticket" {if isset($errors) && $errors}style=""{else}style="display:none"{/if}>
			<input type="submit" name="submitNewTicket" id="submitNewTicket" value="{l s='Post New Ticket'}" class="exclusive" />
			<span><sup>*</sup>{l s='Required field'}</span>
		</p>
	</form>
</div>